<%-- 
    Document   : storydetail
    Created on : 2011-3-13, 19:19:58
    Author     : Administrator
--%>

<%@page import="com.brucexx.wedding.controller.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<script type="text/javascript" src="js/commend.js"></script>
<%@include file="../header.jsp"%>
<style type="text/css">
body {
	font-family: "宋体";
}
</style>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%
	String flag = StringHelper
			.null2String(request.getParameter("flag"));
	String id = StringHelper.null2String(request.getParameter("id"));
	String styleColor = "";
	String title = "";
	if (flag.equals("01")) {
		styleColor = "#108ac6";
		title = "風一般的男子，風一般的故事";
	} else if (flag.equals("02")) {
		styleColor = "#990099";
		title = "默默的生活，默默的祈福";
	}
	String domainBath = request.getScheme() + "://"
			+ request.getServerName() + request.getContextPath() + "/"
			+ UploadController.PIC_FOLDER + flag + "/";

	Story story = BaseModelDAO.loadById(
			NumberHelper.string2Long(id, -1), Story.class);
	if (story == null)
		story = new Story();
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=StringHelper.null2String(story.getStoryName())%></title>
</head>
<body>
	<div style="width: 100%; text-align: center;">
		<div
			style="width: 950px;height: 50px;margin:4px auto;padding-top:20px;font-size: 30px;color: white;background-color:<%=styleColor%>;font-weight: bold;"><%=title%></div>
		<div
			style="width: 930px;margin:10px auto;color:<%=styleColor%>;font-size: 22px;font-weight: bold;">
			<%=StringHelper.null2String(story.getStoryName())%>
		</div>
		<div style="width: 950px; height: 50px; margin: 4px auto;">
			<div style="float: none;">
				作者:<font
					style="color:<%=styleColor%>;font-weight: bold;font-size:14px;"><%=StringHelper.null2String(story.getStoryName())%></font>
			</div>
			<div style="float: right">
				共浏览<%=StringHelper.null2String(story.getBrowseAmount())%>次
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 创建时间:<%=DateHelper.getDateTime(story.getGmtCreate())%></div>
		</div>
		<div
			style="width: 930px;margin:10px auto;border: 1px solid <%=styleColor%>;color:black;text-align: left;padding: 10px;">
			<p>
				<%
					if (PermissionDAO.isAdmin(session)) {
				%><a href="story_edit.action?id=<%=id%>&flag=<%=flag%>">编辑</a> <a
					href="javascript:if(window.confirm('您确定删除吗？删除后不可恢复并且会删除相关评论.')){window.location.href='story_del.action?id=<%=id%>&flag=<%=flag%>'}">删除</a>
				<%
					}
				%>
			</p>
			<%=StringHelper.null2String(story.getStoryContent())%>
			<br>
			<p>
				&nbsp;&nbsp;&nbsp;最后修改时间:<%=DateHelper.getDateTime(story.getGmtModify())%></p>
		</div>

		<div
			style="width: 950px; height: 15px; margin: 4px auto; text-align: left">
			所有评论（共<span id="commendcount"></span>条）:
		</div>
		<div style="width: 950px; margin: 4px auto; text-align: left;">

			<div>
				<div id="commends" style="border: 1px solid <%=styleColor%>;">


				</div>
				<br>
				<div style="width: 100%;">
					<div style="float: right; padding-right: 20px; height: 20px"
						id="page_seg"></div>
					<input type="hidden" id="pageCount" name="pageCount" value="8" />
					<input type="hidden" id="curPage" name="curPage" value="1" /> <input
						type="hidden" id="flag" name="flag" value="<%=flag%>" />
				</div>
				<br> <br>
				<hr style="border-bottom-color:<%=styleColor%>;">
				发表评论
				<div style="padding: 5px; height: 210px;">
					<div style="height: 20px; margin: 5px;">
						您的名字：<input type="text" style="border:1px solid <%=styleColor%>;"
							id="name" name="name" value="" />
					</div>
					<div
						style="padding: 5px; float: left; width: 60%; height: 160px; margin: 3px;">
						<textarea id="commend" name="commend" rows="20" cols="60"
							style="height: 100%;border:1px solid <%=styleColor%>;"></textarea>
					</div>
					<div style="width: 38%; float: left; height: 180px;"><%@include
							file="../base/face.jsp"%></div>
				</div>
				<div style="float: none">
					<input type="button" value="评论"
						onclick="addCommends(this,<%="'" + styleColor + "'"%>,<%="'" + flag + "'"%>,<%="'" + id + "'"%>)" />
				</div>
			</div>
		</div>

		<input type="hidden" id="flag" name="flag" value="<%=flag%>" /> <input
			type="hidden" id="id" name="id" value="<%=id%>" />
	</div>

	<script>
    function fixtext(txt){
        insertAtCursor(f$("commend"),txt);
    }
    loadCommends(null,<%="'" + styleColor + "'"%>,<%="'" + flag + "'"%>,<%="'" + id + "'"%>);
	</script>
</body>
</html>
